{extend name="layout/layout" /}

{block name="pagecss"}
<style>
	.img-left {
		width: 75px;
	    height: 40px;
	}
	.name-right{
		
	}	
</style>
{/block}

{block name="content"}
<div class="row js-check-wrap">
	<div class="col-lg-12">
		<div class="box box-success">
			<div class="box-header with-border">
				<div class="row">
					<div class="col-md-9">
						会员类型
					</div>
				</div>
				<div class="box-tools pull-right">
					<a href="{:url('admin/membertype/add')}" class="btn btn-primary btn-sm" onclick="return checkPrice();" ><i class="fa fa-plus"></i> 新增会员类型</a>
				</div>
			</div>
			<div class="box-body ">
				<form class="js-ajax-form" method="post">
					<div class="table-responsive">
						<table class="table table-striped table-bordered table-hover table-checkable order-column" id="table_order">
							<thead>
							<tr>
								<th>会员类型</th>
								<!-- <th>名称/规格</th> -->
								<th>开通条件</th>
								<!-- <th>用户</th> -->
								<!-- <th>支付方式</th> -->
								<th>用户数</th>
								<th>创建时间</th>
								<th>状态</th>
								<!-- <th>兑换积分</th> -->
								<th>操作</th>
							</tr>
							</thead>
							<tbody>
							{volist name="memberList" id="vo"}
							<tr>
								<td>
									<span><img class="img-left" src="{$vo.img}"></span>
									<span class="name-right">{$vo.memType}</span>
								</td>
								<td>
									{if condition="($vo.openCondition == 1)"}
									充值开通
									{else /}
									无条件开通
									{/if}
								</td>
								<td>{$vo.member ? count($vo.member) : 0}</td>
								<td>{$vo.create_time}</td>
								<td>
									{switch name="vo.status"}
										{case value="0"}未启用{/case}
										{case value="1"}使用中{/case}
										{case value="2"}已禁用{/case}
										{default /}default
									{/switch}
								</td>
								<td>
									<a href="{:url('/admin/Membertype/edit',['id'=>$vo['id']])}" class="btn btn-info btn-xs">编辑</a>
									<a href="{:url('/admin/Membertype/delete',['id'=>$vo['id']])}" class="btn btn-danger btn-xs handle-btn">删除</a>
									{if condition="($vo.status == 1)"}
										<a href="{:url('/admin/Membertype/disable',['id'=>$vo['id']])}" class="btn btn-warning btn-xs handle-btn">禁用</a>
									{else /}
										<a href="{:url('/admin/Membertype/enable',['id'=>$vo['id']])}" class="btn btn-success btn-xs handle-btn">启用</a>
									{/if}

								</td>
							</tr>
							{/volist}
							</tbody>
						</table>
					</div>
					<div class="box-footer">
						{$memberList->render()}
					</div>
				</form>
			</div>
		</div>
	</div>
</div>

{/block}

{block name="pagescript"}
<script>
	var check_url = "{:url('admin/Membertype/checkPrice')}";
</script>
<script src="__STATIC__/admin/pages/js/memberType.js?v={:time()}" type="text/javascript"></script>
{/block}